package org.stusys.dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.stusys.dao.studentDao;
import org.stusys.dao.util.AliPool;
import org.stusys.entity.Student;

public class studentDaoimpl implements studentDao {
	@Override
	public List<Student> find(int id) throws SQLException {
		String sql="select * from student LIMIT ?,10";
		Connection conn=AliPool.getconn();
		List<Student> list=new ArrayList<Student>();
		try {
			PreparedStatement pst=conn.prepareStatement(sql);
			pst.setInt(1, id);
			ResultSet rs=pst.executeQuery();
			while(rs.next()){
				String name=rs.getString(3);
				String pass=rs.getString(4);
				String sex=rs.getString(6);
				Student s=new Student(name, pass, sex);
				list.add(s);
				System.out.println(s);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

}
